package com.shujia.createdata;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.HashMap;
import java.util.Random;

/*
    将学生数据扩大52000倍
 */
public class CreateDataDemo {
    public static void main(String[] args) throws Exception{
        HashMap<Integer, String> map = new HashMap<>();
        map.put(0,"2023-11-21");
        map.put(1,"2023-11-22");

        Random random = new Random();

        System.out.println("开始扩大。。。");

        long num = 0;
        BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\studentsbig.csv"));
        for(int i=1;i<=110000;i++){
            BufferedReader br = new BufferedReader(new FileReader("mysql-jdbc/src/main/java/com/shujia/createdata/students.csv"));
            String line = null;
            while ((line=br.readLine())!=null){
                num++;
                int i1 = random.nextInt(2);
                String time = map.get(i1);
                bw.write(line+","+time);
                bw.newLine();
                bw.flush();
            }
            br.close();
        }

        System.out.println("扩大结束。。。"+num);
//        int i1 = random.nextInt(2);
//        System.out.println(i1);

    }
}
